import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import mutations from './mutations'

Vue.use(Vuex)

export default new Vuex.Store({
	state:state,
	//异步  调用 this.store.dispatch('changeCity',city)
	// actions: {
	// 	changeCity (context, city) {
	// 		//调用mutations的方法
	// 		context.commit('changeCity')
	// 	}
	// },
	//this.$store.commit(方法,值)调用 ------ 同步
	mutations:mutations
	//类似vue computed计算属性   import {mapGetters} from 'vuex'     computed: {...mapGetters(['参数'])}
	// getters: {
	// 	doubleCity (state) {
	// 		return state.city + ' ' +state.city
	// 	}
	// }
})